@use "variables" as *;

// 全局样式
:root {
  --el-color-primary: #409eff;
  --el-color-success: #67c23a;
  --el-color-warning: #e6a23c;
  --el-color-danger: #f56c6c;
  --el-color-info: #909399;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  background-color: $bg-color;
}

#app {
  height: 100%;
}

// 主布局
.app-container {
  display: flex;
  height: 100%;
}

.main-content {
  padding: 0;
  flex-grow: 1;
  overflow-y: auto;
}

// 所有页面容器的通用样式
.departments-container {
  padding: 20px;
  margin: 0;
  background-color: $bg-color-light;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
  
  .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    
    .page-title {
      margin: 0;
      font-size: 24px;
    }
  }
}

// 侧边栏
.sidebar {
  width: 240px;
  height: 100%;
  background-color: #304156;
  transition: width 0.3s;
  overflow: hidden;
  
  &.collapsed {
    width: 64px;
  }
  
  .sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    color: #fff;
    
    .logo {
      font-size: 18px;
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    
    .collapse-icon {
      cursor: pointer;
      font-size: 20px;
      
      &:hover {
        color: var(--el-color-primary);
      }
    }
  }
}

// 主内容区域包装器
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

// 页面标题
.page-title {
  margin-bottom: 20px;
  font-size: 22px;
  font-weight: 600;
  color: #303133;
}

// 顶部导航栏
.navbar {
  background-color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  
  .logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--el-color-primary);
    margin-right: 40px;
  }
  
  .menu {
    flex: 1;
  }
  
  .user-area {
    display: flex;
    align-items: center;
    
    .ws-indicator {
      margin-right: 20px;
      display: flex;
      align-items: center;
      
      .ws-status {
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        margin-right: 6px;
        
        &.connected {
          background-color: var(--el-color-success);
        }
        
        &.disconnected {
          background-color: var(--el-color-danger);
        }
        
        &.connecting {
          background-color: var(--el-color-warning);
          animation: blink 1s infinite;
        }
      }
      
      .ws-text {
        font-size: 12px;
        color: #909399;
      }
    }
  }
}

// 统计卡片
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
  
  .stats-card {
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.3s;
    
    &:hover {
      transform: translateY(-5px);
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
    
    &.success {
      .el-card__header {
        background-color: var(--el-color-success);
      }
      
      .stats-value {
        color: var(--el-color-success);
      }
    }
    
    &.warning {
      .el-card__header {
        background-color: var(--el-color-warning);
      }
      
      .stats-value {
        color: var(--el-color-warning);
      }
    }
    
    &.danger {
      .el-card__header {
        background-color: var(--el-color-danger);
      }
      
      .stats-value {
        color: var(--el-color-danger);
      }
    }
    
    .el-card__header {
      padding: 12px 16px;
      color: #fff;
      
      .card-header {
        display: flex;
        align-items: center;
        
        .el-icon {
          margin-right: 8px;
          font-size: 18px;
        }
      }
    }
    
    .stats-value {
      font-size: 32px;
      font-weight: bold;
      text-align: center;
      padding: 20px 0;
    }
  }
}

// 内容卡片
.content-card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  padding: 20px;
  
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    
    .card-title {
      font-size: 16px;
      font-weight: 600;
      color: #303133;
    }
  }
}

// 加载状态
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

// 任务详情
.task-detail {
  .detail-item {
    display: flex;
    margin-bottom: 12px;
    
    .detail-label {
      width: 100px;
      color: #606266;
      font-weight: 500;
      text-align: right;
      padding-right: 12px;
    }
    
    .detail-value {
      flex: 1;
      color: #303133;
    }
  }
}

// 图表容器
.chart-container {
  height: 350px;
  position: relative;
}

// 状态标签
.status-tag {
  &.success {
    --el-tag-bg-color: rgba(103, 194, 58, 0.1);
    --el-tag-text-color: var(--el-color-success);
    --el-tag-border-color: rgba(103, 194, 58, 0.2);
  }
  
  &.warning {
    --el-tag-bg-color: rgba(230, 162, 60, 0.1);
    --el-tag-text-color: var(--el-color-warning);
    --el-tag-border-color: rgba(230, 162, 60, 0.2);
  }
  
  &.danger {
    --el-tag-bg-color: rgba(245, 108, 108, 0.1);
    --el-tag-text-color: var(--el-color-danger);
    --el-tag-border-color: rgba(245, 108, 108, 0.2);
  }
}

// 动画
@keyframes blink {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

// 登录页面
.login-container {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #7367f0, #CE9FFC);
  
  .login-card {
    width: 380px;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    background-color: #fff;
    
    .login-header {
      text-align: center;
      margin-bottom: 30px;
      
      .login-title {
        font-size: 24px;
        font-weight: 600;
        color: #303133;
        margin-bottom: 10px;
      }
      
      .login-subtitle {
        color: #909399;
        font-size: 14px;
      }
    }
    
    .login-form {
      .el-form-item {
        margin-bottom: 25px;
      }

      .el-input {
        width: 100%;
        
        .el-input__wrapper {
          width: 100%;
        }
      }
      .login-button {
        width: 100%;
        margin-top: 15px;
      }
    }
  }
}

// 响应式调整
@media (max-width: 768px) {
  .stats-cards {
    grid-template-columns: 1fr;
  }
  
  .navbar {
    .logo {
      margin-right: 20px;
    }
  }
  
  .content-card {
    .card-header {
      flex-direction: column;
      align-items: flex-start;
      
      .card-actions {
        margin-top: 10px;
        width: 100%;
      }
    }
  }
} 